Skip to content

Fixed test generation for paths with spaces in JavaScript #1596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 6, 2023

Conversation

zishkaz
Copy link
Collaborator

@zishkaz zishkaz commented Dec 27, 2022

Description

Now UTBot JavaScript supports test generation for files and directories with spaces in their paths.

Fixes #1586

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Manually

Manual Scenario

  • Create directory with spaces in its name.
  • Place a JavaScript file there and run test generation.
  • Tests are generated.

Checklist (remove irrelevant options):

This is the author self-check list

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • No new warnings
  • All tests pass locally with my changes

@zishkaz zishkaz added ctg-bug Issue is a bug lang-javascript Issue is related to JavaScript support labels Dec 27, 2022
@zishkaz zishkaz requested a review from denis-fokin December 27, 2022 12:20
@alisevych alisevych added ctg-bug-fix PR is fixing a bug and removed ctg-bug Issue is a bug labels Jan 24, 2023
JsDialogWindow(it)
} catch (e: NoSuchElementException) {
Messages.showErrorDialog(
"Node.js interpreter is not found in IDEA settings.\n" +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do kotlin multiline strings with trim work here?

@denis-fokin denis-fokin requested review from denis-fokin and Markoutte and removed request for denis-fokin January 27, 2023 07:22
Copy link
Collaborator

@Markoutte Markoutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot run action to generate test on Windows because of error:

java.io.IOException: Cannot run program ""npm"" (in directory "D:\Developer\untitled-js"): CreateProcess error=2, The system cannot find the file specified
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
	at utils.JsCmdExec.runCommand(JsCmdExec.kt:21)
	at org.utbot.intellij.plugin.language.js.UtilsKt.npmListByFlag(Utils.kt:26)
	at org.utbot.intellij.plugin.language.js.UtilsKt.findFrameworkLibrary(Utils.kt:38)
	at org.utbot.intellij.plugin.language.js.UtilsKt.getFrameworkLibraryPath(Utils.kt:18)
	at org.utbot.intellij.plugin.language.js.JsDialogProcessor$createDialogAndGenerateTests$1$run$$inlined$invokeLater$1.run(ApplicationUtils.kt:94)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:513)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:75)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:118)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:779)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:749)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:766)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.base/java.lang.ProcessImpl.create(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
	... 37 more

zishkaz and others added 6 commits February 1, 2023 11:40
# Conflicts:
#	utbot-cli-js/src/main/kotlin/org/utbot/cli/js/JsRunTestsCommand.kt
#	utbot-intellij-js/src/main/kotlin/org/utbot/intellij/plugin/language/js/JsDialogProcessor.kt
#	utbot-intellij-js/src/main/kotlin/org/utbot/intellij/plugin/language/js/Utils.kt
#	utbot-js/src/main/kotlin/service/FastCoverageService.kt
#	utbot-js/src/main/kotlin/service/TernService.kt
#	utbot-js/src/main/kotlin/utils/JsCmdExec.kt
@rudolf101 rudolf101 merged commit 2d22922 into main Feb 6, 2023
@rudolf101 rudolf101 deleted the sergeyl/js-paths-with-spaces branch February 6, 2023 13:51
@alisevych alisevych added this to the 2023.03 Release milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctg-bug-fix PR is fixing a bug lang-javascript Issue is related to JavaScript support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No JS tests are generated when project path has spaces
5 participants